project(rnapp)
cmake_minimum_required(VERSION 3.4.1)
set(CMAKE_CXX_STANDARD 17)
set(OH_MODULES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules")
set(NODE_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../node_modules")
set(OH_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules")
set(OH_MODULE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules")
set(RNOH_APP_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
set(RNOH_CPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../oh_modules/@rnoh/react-native-openharmony/src/main/cpp")
set(REACT_NATIVE_DEVICE_INFO_CPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules/@react-native-ohos/react-native-device-info/src/main/cpp")
set(REACT_NATIVE_SIGNATURE_CAPTURE_CPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules/@react-native-ohos/react-native-signature-capture/src/main/cpp")
#set(RNOH_GENERATED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/generated")
set(WITH_HITRACE_SYSTRACE 1)
add_compile_definitions(WITH_HITRACE_SYSTRACE)

add_subdirectory("${RNOH_CPP_DIR}" ./rn)

# RNOH_BEGIN: manual_package_linking_1
add_subdirectory("${OH_MODULES}/@react-native-ohos/picker/src/main/cpp" ./picker)
add_subdirectory("${OH_MODULES}/@react-native-ohos/lottie-react-native/src/main/cpp" ./lottie)
add_subdirectory("${OH_MODULES}/@react-native-ohos/datetimepicker/src/main/cpp" ./datetimepicker)
add_subdirectory("${OH_MODULES}/@react-native-ohos/blur/src/main/cpp" ./blur)
add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-webview/src/main/cpp" ./webview)
add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-pager-view/src/main/cpp" ./pager_view)
add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-safe-area-context/src/main/cpp" ./safe-area)
add_subdirectory("${OH_MODULES}/@react-native-ohos/flash-list/src/main/cpp" ./flash-list)
add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-gesture-handler/src/main/cpp" ./gesture-handler)
add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-reanimated/src/main/cpp" ./reanimated)
add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-spring-scrollview/src/main/cpp" ./spring_scrollview)
add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-video/src/main/cpp" ./video)
add_subdirectory("${OH_MODULES}/@react-native-ohos/masked-view/src/main/cpp" ./masked-view)
add_subdirectory("${OH_MODULES}/@react-native-ohos/slider/src/main/cpp" ./slider)
add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-fs/src/main/cpp" ./fs)
add_subdirectory("${OH_MODULES}/@react-native-ohos/camera-roll/src/main/cpp" ./camera-roll)
add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-maps/src/main/cpp" ./maps)
add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-vision-camera/src/main/cpp" ./vision-camera)
add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-image-crop-picker/src/main/cpp" ./image-crop-picker)
add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-blob-util/src/main/cpp" ./blob-util)
add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-date-picker/src/main/cpp" ./date_picker)
add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-theme-switch-animation/src/main/cpp" ./theme-switch-animation)
add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-search-bar/src/main/cpp" ./search-bar)
add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-email-link/src/main/cpp" ./email_link)
add_subdirectory("${OH_MODULE_DIR}/@react-native-ohos/react-native-compass-heading/src/main/cpp" ./compass_heading)
add_subdirectory("${OH_MODULE_DIR}/@react-native-ohos/react-native-theme-control/src/main/cpp" ./themecontrol)
add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-unistyles/src/main/cpp" ./unistyles)
add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-context-menu-view/src/main/cpp" ./context_menu)
add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-shake/src/main/cpp" ./shake_package)
add_subdirectory("${OH_MODULES}/@react-native-ohos/mixpanel-react-native/src/main/cpp" ./mixpanel)
add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-audio-recorder-player/src/main/cpp" ./audio_recorder_player)
add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-snackbar/src/main/cpp" ./react-native-snackbar)
add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-apple-authentication/src/main/cpp" ./react-native-apple-authentication)
add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-system-setting/src/main/cpp" ./system-setting)
add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-keyboard-controller/src/main/cpp" ./keyboard-controller)
add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-text-input-mask/src/main/cpp" ./RNTextInputMask)
add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-nfc-manager/src/main/cpp" ./nfc-manager)
add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-haptic-feedback/src/main/cpp" ./haptic-feedback)
add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-custom-keyboard/src/main/cpp" ./custom-keyboard)
add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-idle-timer/src/main/cpp" ./idle-timer)
add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-file-access/src/main/cpp" ./file_access)
add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-background-fetch/src/main/cpp" ./background_fetch)
add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-ui-lib/src/main/cpp" ./ui-lib)
add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-create-thumbnail/src/main/cpp" ./create-thumbnail)
add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-skia/src/main/cpp" ./skia)
add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-alipay/src/main/cpp" ./alipay)
add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-config/src/main/cpp" ./config)
add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-svg/src/main/cpp" ./svg)
add_subdirectory("${REACT_NATIVE_DEVICE_INFO_CPP_DIR}" ./device_info)
# RNOH_END: manual_package_linking_1

# file(GLOB GENERATED_CPP_FILES "./generated/*.cpp")
file(GLOB VISION_CAMERA_CPP_FILES "${OH_MODULES}/@react-native-ohos/react-native-vision-camera/src/main/cpp/*.cpp")
include_directories(${REACT_NATIVE_SIGNATURE_CAPTURE_CPP_DIR})

add_library(rnoh_app SHARED
#    ${GENERATED_CPP_FILES}
    ${VISION_CAMERA_CPP_FILES}
    "./PackageProvider.cpp"
    "${RNOH_CPP_DIR}/RNOHAppNapiBridge.cpp"
)

target_link_libraries(rnoh_app PUBLIC rnoh)

# RNOH_BEGIN: manual_package_linking_2
target_link_libraries(rnoh_app PUBLIC rnoh_picker)
target_link_libraries(rnoh_app PUBLIC rnoh_lottie)
target_link_libraries(rnoh_app PUBLIC rnoh_datetime_picker)
target_link_libraries(rnoh_app PUBLIC rnoh_blur)
target_link_libraries(rnoh_app PUBLIC rnoh_webview)
target_link_libraries(rnoh_app PUBLIC rnoh_pager_view)
target_link_libraries(rnoh_app PUBLIC rnoh_safe_area)
target_link_libraries(rnoh_app PUBLIC rnoh_flash_list)
target_link_libraries(rnoh_app PUBLIC rnoh_gesture_handler)
target_link_libraries(rnoh_app PUBLIC rnoh_reanimated)
target_link_libraries(rnoh_app PUBLIC rnoh_spring_scrollview)
target_link_libraries(rnoh_app PUBLIC rnoh_video)
target_link_libraries(rnoh_app PUBLIC rnoh_masked_view)
target_link_libraries(rnoh_app PUBLIC rnoh_slider)
target_link_libraries(rnoh_app PUBLIC rnoh_fs)
target_link_libraries(rnoh_app PUBLIC rnoh_camera_roll)
target_link_libraries(rnoh_app PUBLIC rnoh_maps)
target_link_libraries(rnoh_app PUBLIC rnoh_vision_camera)
target_link_libraries(rnoh_app PUBLIC rnoh_image_crop_picker)
target_link_libraries(rnoh_app PUBLIC rnoh_blob_util)
target_link_libraries(rnoh_app PUBLIC rnoh_date_picker)
target_link_libraries(rnoh_app PUBLIC rnoh_theme_switch_animation)
target_link_libraries(rnoh_app PUBLIC rnoh_search_bar)
target_link_libraries(rnoh_app PUBLIC rnoh_email_link)
target_link_libraries(rnoh_app PUBLIC rnoh_compass_heading)
target_link_libraries(rnoh_app PUBLIC rnoh_theme_control)
target_link_libraries(rnoh_app PUBLIC rnoh_unistyles)
target_link_libraries(rnoh_app PUBLIC rnoh_context_menu)
target_link_libraries(rnoh_app PUBLIC rnoh_shake)
target_link_libraries(rnoh_app PUBLIC rnoh_mixpanel)
target_link_libraries(rnoh_app PUBLIC rnoh_audio_recorder_player)
target_link_libraries(rnoh_app PUBLIC rnoh_snackbar)
target_link_libraries(rnoh_app PUBLIC rnoh_apple_authentication)
target_link_libraries(rnoh_app PUBLIC rnoh_system_setting)
target_link_libraries(rnoh_app PUBLIC rnoh_keyboard_controller)
target_link_libraries(rnoh_app PUBLIC text_input_mask)
target_link_libraries(rnoh_app PUBLIC rnoh_nfc_manager)
target_link_libraries(rnoh_app PUBLIC rnoh_haptic_feedback)
target_link_libraries(rnoh_app PUBLIC rnoh_custom_keyboard_package)
target_link_libraries(rnoh_app PUBLIC rnoh_idle_timer)
target_link_libraries(rnoh_app PUBLIC rnoh_file_access)
target_link_libraries(rnoh_app PUBLIC rnoh_background_fetch)
target_link_libraries(rnoh_app PUBLIC rnoh_ui_lib)
target_link_libraries(rnoh_app PUBLIC rnoh_create_thumbnail)
target_link_libraries(rnoh_app PUBLIC rnoh_skia)
target_link_libraries(rnoh_app PUBLIC rnoh_alipay)
target_link_libraries(rnoh_app PUBLIC rnoh_config)
target_link_libraries(rnoh_app PUBLIC rnoh_svg)
target_link_libraries(rnoh_app PUBLIC device_info)
# RNOH_END: link_packages
